Home:ALL Converter>Linux Kernel Module programming Makefile error

Linux Kernel Module programming Makefile error

Ask Time:2013-01-22T03:40:28         Author:user1495372

Json Formatter

I am trying to compile a "Hello world" linux kernel module programming in Fedora 14. My kernel version is "2.6.35.14-97.fc14.i686" which i am referring to /lib/modules/$(shell uname -r)/build M=$(PWD) modules in the make file to compile my hello.o program.

This "build" file showing it as special file and linked to source in /lib/module/2.6....i686/ folder.

When i compile my code getting below error.

make -C /lib/modules/2.6.35.14-97.fc14.i686/build M=/root/kernel modules
make: *** /lib/modules/2.6.35.14-97.fc14.i686/build: No such file or directory.  Stop.

My Makefile :

obj-m +=hello.o

all:
        make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules

Please give me solution to run this module program.

Author:user1495372,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/14445988/linux-kernel-module-programming-makefile-error
Khanal :

You should only need 'kernel-devel' which you can install using yum for it. I use ubuntu and I just had to download the package 3.5.0-22-generic for it to work but a quick 'Kernal development module for Fedora' search on google led me Here\nHope this helps. ",
2013-01-23T00:33:13
Sudharasan D :

compile your kernel and install the modules INSTALL_MOD_PATH=/path/\nwhile compiling your hello world .link module path like \nMAKE -C KDIR=INSTALL_MOD_PATH M='$PWD' modules",
2014-05-12T13:55:19
prateekhalwe :

As suggested by others please install \"kernel-devel\". This worked perfectly for me. \n\nYou can install it by:\n\nyum install kernel-devel\n",
2016-11-21T14:33:46
yy